<template>
    <div>
     <el-form :label-position="labelPosition" label-width="80px" :model="formLabelAlign">
  <el-form-item label="名称">
    <el-input v-model="formLabelAlign.name"></el-input>
  </el-form-item>
  <el-form-item label="公司">
    <el-input v-model="formLabelAlign.companyid"></el-input>
  </el-form-item>
  <el-form-item label="电话">
    <el-input v-model="formLabelAlign.Phone"></el-input>
  </el-form-item>
    <el-form-item label="年龄">
    <el-input v-model="formLabelAlign.age "></el-input>
  </el-form-item>
    <el-form-item label="邮箱">
    <el-input v-model="formLabelAlign.email"></el-input>
  </el-form-item>
</el-form>
 <el-button @click="Editeput" type="primary" plain>更改</el-button>
    </div>
</template>

<script>
import axios from "axios";
import { Message } from 'element-ui';
export default{
          data() {
      return {
        labelPosition: 'left',
        formLabelAlign: {
          name: '',
          Phone: '',
          email: '',
          age:'',
          companyid:''
       
          
        },
           MSG:""
      };
    },
     created: function() {
   
  },
    methods:{

       Editeput(){
         console.log(this.$route.params.id)
         let thiss = this
          axios
        .patch(" http://192.168.1.104:9999/users/"+thiss.$route.params.id, {
           name:thiss.formLabelAlign.name,
           age:thiss.formLabelAlign.age,
           email:thiss.formLabelAlign.email,
           companyid:thiss.formLabelAlign.companyid,
           Phone:thiss.formLabelAlign.Phone

        })
        .then(function(response) {
          if (response.status==200) {
            thiss.MSG = "恭喜您更改成功 即将返回首页 ！！"
           Message.success("更改成功")
            thiss.$router.push({path:'/About'})
            
           
          
          } 
      
        
      
        })
        .catch(function(error) {
          console.log(error);
        });
        
       }
    }     
}
</script>
<style scoped>
            
</style>